// 该文件专门创建Store的实例对象
import {observable,action} from 'mobx-miniprogram'

export const store = observable({
  numA:1,
  numB:2,
  // tabBar的索引
  activeTabBarIndex: 0,
  // 计算属性
  get sum(){
    return this.numA+this.numB
  },
  // action方法，用来修改store中数据
  updataNum1:action(function (params) {
    this.numA += params
  }),
  updataNum2:action(function (params) {
    this.numB += params
  }),
  updataActiveTabBarIndex:action(function (index) {
    this.activeTabBarIndex = index
  }),
})